<script type="text/javascript">
$(function(){

	$(".button").click(function(){
		var textArea = $('#testo');
		var start = textArea[0].selectionStart;
		var end = textArea[0].selectionEnd;
		var replacement = $(this).attr('id');
		textArea.val(textArea.val().substring(0, start) + replacement + textArea.val().substring(end, textArea.val().length));
	
	});
});

</script>
<h1><?php echo $title; ?></h1>
<div class="noprint">
<?php if (isset($notice) || $notice = $this->session->flashdata('notification')):?>
<p class="notice"><?php echo $notice;?></p>
<?php endif;?>



<form method='post' name="form1" id="form1" action="<?php echo site_url('adozioni/lettere/salva') ?>" >

<div class="form">



<div class="row">
<div class="label">


<label for="nome"><?php echo __("Nome della lettera", $module) ?></label>
</div>
<div class="input">
<input type="text" name="nome" value="<?php if(isset($row['nome']))  echo $row['nome'] ?>" class=""/>


</div>
</div>
<div class="row">
<div class="label">



<label for="oggetto"><?php echo __("Oggetto", $module) ?></label>

</div>
<div class="input">


<input type="text" name="oggetto" value="<?php if(isset($row['oggetto']))  echo $row['oggetto'] ?>" class=""/>

</div>
</div>
<div class="row">
<div class="label">


<label for="testo"><?php echo __("Testo", $module) ?></label>

</div>
<div class="input">

<div class="toolbox">
<input type="button" id="{TITOLO}" class="button" value="TITOLO"/>
<input type="button" id="{SOSTENITORE}" class="button" value="SOSTENITORE"/>
<input type="button" id="{ASSISTITO}" class="button" value="ASSISTITO"/>
<input type="button" id="{NUOVO ASSISTITO}" class="button" value="NUOVO ASSISTITO"/>
<input type="button" id="{MISSIONE}" class="button" value="MISSIONE"/>
<input type="button" id="{REFERENTE}" class="button" value="REFERENTE"/>
<input type="button" id="{DATA CONTATTO}" class="button" value="DATA CONTATTO"/>
<input type="button" id="{NUOVA MISSIONE}" class="button" value="NUOVA MISSIONE"/>
<input type="button" id="{LORDO}" class="button" value="LORDO"/>

</div>
<textarea  name="testo" id="testo" class="area" ><?php if(isset($row['testo'])) echo $row['testo'] ?></textarea>

</div>
</div>


<div class="buttons">


<input type="submit" name="submit" id="submit" value=" <?php echo __("Salva", $module) ?> " />
<a href="<?php echo site_url('adozioni/lettere/gestione') ?>" ><?php echo __("Annulla", $module) ?></a>

</div>
</div>
<input type="hidden" name="id" value="<?php echo $row['id'] ?>" />
</form>